ODRefCntObject
- Superclasses
ODObject
- Subclasses
ODContainer
,ODDocument
,ODDraft
,ODExtension
,ODMenuBar
,ODPersistentObject
,ODShape
,ODStorageUnit
,ODTransform
, andODWindow
An object of the
ODRefCntObject
class implements reference counting, a mechanism that allows OpenDoc to manage memory used by objects.Description
In a typical OpenDoc session, various objects are shared by other objects, each of which has a reference to the shared object. A shared object should not be deleted as long as any object is using it. OpenDoc uses reference counting to manage memory for shared objects. Each reference-counted object keeps track of the number of existing references to it. An object's reference count indicates the number of objects that are currently using it. When an object's reference count drops to 0, no other object is using it; only then is it safe to delete the object, freeing the space it occupies in memory.The
ODRefCntObject
class is the abstract superclass for all OpenDoc classes whose objects require reference counting. You should never instantiateODRefCntObject
itself, but you can instantiate a subclass by calling the appropriate factory method. If the factory method creates a new object, it sets the reference count for that object to 1; if the factory method returns a reference to an existing object, it increments that object's reference count by 1.Memory management for each reference-counted class is the responsibility of its factory class. For example, the
ODStorageSystem
class is the factory class for theODContainer
class; that is, the storage system's factory method creates a container object. When the container object's reference count drops to 0, it informs the storage system, which deletes the container object.Methods
This section presents summary descriptions of theODRefCntObject
methods grouped according to purpose, followed by detailed descriptions in alphabetical order.Managing the Reference Count
GetRefCount
- Returns the current reference count of this object.
Acquire
- Increments an object's reference count by 1.
Release
- Decrements an object's reference count by 1.
Methods
Acquire
GetRefCount
Release
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help